import { observable, action } from 'mobx'

export default class SetUpVM {
  constructor (props) {
    this.props = props
    this.PageInitialization()
  }

  // 用户手机号
  @observable phoneNumber = ''

  // 跳转到修改手机号页面
  @action handleToChangePhone = () => {
    this.props.history.push('/changePhone')
  }

  // 跳转到修改密码页面
  @action handleToChangePassword = () => {
    this.props.history.push('/passwordForget')
  }
  // 退出登录
  @action handleSignOut = () => {
    window.localStorage.setItem('UserId', '')
    window.sessionStorage.setItem('indexCurrent', '')
    window.localStorage.setItem('WZUserName', '')
    window.localStorage.setItem('WZPassWord', '')
    this.props.history.push('/center')
  }

  @action PageInitialization = async () => {
    this.phoneNumber = this.props.history.location.search.split('?')[1]
  }
}
